package com.cragon.listener;

import java.util.Enumeration;
import java.util.EventObject;
import java.util.Vector;

/**
 * @Description: 事件源Button
 * @Author: ZHOUHAILONG
 * @Date: 2020年07月31日 10:28
 */
public class Button {
	private OnClickListener clickListener;

	public void setClickListener(OnClickListener clickListener) {
		this.clickListener = clickListener;
	}

	public void handleEvent(EventObject event) {
		if (event instanceof ClickEvent) {
			ClickEvent e = (ClickEvent) event;
			switch (e.getId()) {
				case ClickEvent.SINGLE_CLICK:
					this.clickListener.click(e);
					break;
				case ClickEvent.DOUBLE_CLICK:
					this.clickListener.doubleClick(e);
					break;
			}
		}
	}
}
